//============用于对filedata.c文件的测试======
//=====[问题一]:在文件最后一行没有使用换行符时,循环并写入只读文件中[未知现象,仅对文件进行了操作,]=========
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>

#include "filedata.h"
#include "function.h"
#include "tlinklist.h"
#include "slinklist.h"

int main()
{
	//创建相关的数据链表
	pLink PL = (pLink)malloc(sizeof(pLink));
	tLink TL = Create_tLink();
	sLink SL = Create_sLink();

	//加载文件
	Read_Data_P(PL);
	printf("%s\n",PL->password);
	Read_Data_T(TL);
	Travel_tLink(TL);
	Read_Data_S(SL);
	Travel_sLink(SL);

	//数据处理
	strcpy(PL->password,"hik123245");
	Insert_tLink(TL,15045260,"hik12345","刘老师","11111111111",0);
	Insert_sLink(SL,15015228,"hik12345","刘同学","男","346159199525866684","18155586697",0);
	Add_Data_S(SL);
	Add_Data_Score(SL);

	//保存数据
	Write_Data_P(PL);
	printf("校长\n");
	Write_Data_T(TL);
	printf("教师\n");
	Write_Data_S(SL);
	printf("学生\n");
}
